﻿using CodeCreator;
using CodeCreator.Template;
using CodeTemplate.DbHelper.CoreObj;
using iBing.Common.DbHelper;
using iBing.Common.DbHelper.CoreObj;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeTemplate.CodeEdit
{
    public class ToolForGetConditions
    {
        public static List<ObjForQuery> getObjForConditions(List<DbField> dbFields)
        {
            List<ObjForQuery> result = new List<ObjForQuery>();
            foreach (DbField f in dbFields)
            {
                ObjForQuery jf = new ObjForQuery();
                jf.Field = Tools.DbFile2JavaFieldWidtFirstLower(f.FieldName);
                jf.Title = Tools.DbFile2JavaFieldWidtFirstLower(f.FieldName);
                jf.IsUse = false;
                if (f.FieldType.ToUpper() == "DATE" || f.FieldType.ToUpper() == "DATETIME")
                    jf.Type = "date";
                else
                    jf.Type = "text";
                result.Add(jf);
            }
            return result;
        }
    }
}
